//////////////////////////////////////////////////////////////////////////
// File:        TNod.h
// Purpose:     Class which adds the ability to inserts the found license,
//              check for the license with more expiration date and can 
//              save the licenses to a file.
// Modified by: 
// Copyright:   (c) Tukero <tukero@gmail.com>
// Licence:     GNU/LGPL v3
//////////////////////////////////////////////////////////////////////////

#ifndef _TNODCLASS_
#define _TNODCLASS_

#ifndef WX_PRECOMP
#  include <wx/wx.h>
#else
#  include <wx/wxprec.h>
#endif

#include <wx/protocol/http.h>   //to download web pages

#include "ESETManager.h"
#include "TNodBase.h"

class TNod : public TNodBase
{
private:    
    wxString        m_hostPath;
    wxString        m_hostName;
    EsetManager    *m_EsetManager;    
public:
    TNod();
    TNod(EsetManager *esetManager);
    //void            SetEventReceiver(wxFrame* frameForEvent, wxCommandEvent* event2Send);

    License         *m_License2Insert;

    // Action constants, extension of the original
    enum
    {
        CHECK_EXPIRATION = 0x10,
        INSERT_LICENSE = 0x20
    };    
    
    void            Start();
    void            SaveLicenses(LinkListLicense *validLicenses);
    void            InsertLicenseNow(License& license);
    void            CheckValidityAndExpiration(PassServer *server, LinkListLicense *validLicenses,License *excludedLicense , int maxValidLicenses = 1, bool licWithNoExpirationOnly = false);
    void            CheckExpiration(License& license);
    License*        GetLongestExpirationDate(LinkListLicense *validLicenses);
    void            CheckLicensesList(PassServer *server, LinkListLicense *validLicenses, License * excludedLicense);

    void*           Entry();
};


#endif